#include <iostream>
using namespace std;
void main()
{
	int i, j, d1, d2, matrix[100][100];
	char flag;
	cout << "Please input two dimensions of the matrix: ";
	cin >> d1 >> d2;
	cout << "Please input the elements of the matrix: " << endl;
	for (i = 0; i < d2; i++)
	{
		for (j = 0; j < d1; j++)
		{
			cin >> matrix[i][j];
		}
	}
	cout << "The original matrix you input is:" << endl;
	for (i = 0; i < d2; i++)
	{
		for (j = 0; j < d1; j++)
		{
			cout << matrix[i][j] << "  ";
		}
		cout << endl;
	}
	cout << "--------------------------------------------------------------" << endl;
	cout << "Do you want to continue to rotate the matrix?(Y/N)";
	cin >> flag;
	if (flag != 'N')
	{
		for (j = 0; j < d1; j++)
		{
			for (i = 0; i < d2; i++)
			{
				cout << matrix[i][j] << "  ";
			}
			cout << endl;
		}
	}
	system("pause");
}
